<template>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column fixed prop="name" label="姓名" width="150" />
    <el-table-column prop="sex" label="性别" width="120" />
    <el-table-column prop="address" label="住址" width="120" />

    <el-table-column fixed="right" label="操作" min-width="120">
      <template #default>
        <el-button link type="primary" size="small" @click="handleClick">
          删除
        </el-button>
        <el-button link type="primary" size="small">修改</el-button>
      </template>
    </el-table-column>
  </el-table>
  <div class="demonstration">All combined</div>
    <el-pagination
      v-model:current-page="page.pageindex"
      v-model:page-size="page.pagesize"
      :page-sizes="[1, 3, 5, 7]"

      :background="true"
      layout="total, sizes, prev, pager, next, jumper"
      :total="page.totalcount"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
</template>

<script lang="ts" setup>
import { reactive } from 'vue'
const handleClick = () => {
  console.log('click')
}

const page=reactive({
  pageindex:1,
  pagesize:3,
  totalcount:0,
  totalpage:0

})


const tableData = [
  {

    name: 'Tom',
    sex: '男',
    address: '江西',
 
  },
  {
    name: 'li',
    sex: '女',
    address: '上海',
  },
  {
    name: 'yiyi',
    sex: '女',
    address: '北京',
  },
  {
    name: 'mama',
    sex: '女',
    address: '天津',
  },
]
const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
page.pagesize=val
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}

</script>

<style scoped>
</style>


